﻿using InnoWeb.CEND.BL.Infrastructure;
using InnoWeb.CEND.Core.Model.General;
using InnoWeb.CEND.Data;
using InnoWeb.CEND.Data.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InnoWeb.CEND.BL.Service
{
    public class CareerInfoService: IService<CareerInfo>
    {
        private readonly GenericRepository<CareerInfo> _careerRepository;
        private readonly IUnitOfWork _unitOfWork;

        public CareerInfoService(IUnitOfWork unitOfWork, GenericRepository<CareerInfo> careerRepository)
        {
            this._careerRepository = careerRepository;
            this._unitOfWork = unitOfWork;
        }


        public IQueryable<CareerInfo> GetAllElements()
        {
            return _careerRepository.GetAll();
        }

        public CareerInfo GetElementById(int id)
        {
            return _careerRepository.GetById(id);
        }

        public void CreateElement(CareerInfo entity)
        {
            _careerRepository.Insert(entity);
        }

        public void UpdateElement(CareerInfo entity)
        {
            _careerRepository.Update(entity);
        }

        public void DeleteElement(int id)
        {
            _careerRepository.Delete(id);
        }

        public void SaveChanges()
        {
            _unitOfWork.SaveChanges();
        }
    }
}
